<?php
class ConsultationController extends AppController {
	var $uses = array('Licence','User');

	public function isAuthorized(){
		return $this->isConsultationAllowed();
	}
	public function beforeFilter() {
		// the controller decide if the authorization is allowed via isAuthorized() method
		$this->Auth->authorize = array('Controller');
	}



	public function beforeRender(){
		AppController::beforeRender();
		$subMenu = array(
		array ("Licences Compet","/Consultation/index",  $this->params['action'] == 'index'  ),
		array ("Membres",   "/Consultation/members",$this->params['action'] == 'members' )
		);
		$this->set('subMenu',$subMenu);



	}

	public function index(){
		$licencesCompetition = $this->Licence->getAllLicenceCompetition();
		$this->set('licencesCompetition', $licencesCompetition);
		$this->layout = 'connected';
			
			
	}

	public function downloadPdf() {
		$licencesProduced = $this->Licence->getAllLicenceCompetition();
		$this->set('licencesProduced',$licencesProduced);
		$this->layout='pdf';
		$this->render();
	}
	

	public function members() {
		$members = $this->User->getAllValidatedUsers();
		$this->set('members', $members);
		$this->layout = 'connected';
			
	}

	public function downloadMembersPdf() {
		$members = $this->User->getAllValidatedUsers();
		$this->set('members', $members);
		$this->layout='pdf';
	}




}